(function(angular) {
	'use strict';
	angular.module('fs.waf').controller('cda.ppfSiteProfile.viewController', viewController);
	viewController.$inject = [ '$scope', 'Constants', 'layoutConfig', 'validatorConfig', 'gridService', 'authService', 'ppfSiteProfileService' ];
	function viewController($scope, Constants, layoutConfig, validatorConfig, gridService, authService, ppfSiteProfileService) {
		var ctrl = this, ppfSiteProfileInfo = $scope.$stateParams.params;
		//ctrl.layoutConfig = layoutConfig;
		ctrl.validatorConfig = validatorConfig;
		ctrl.ppfSiteProfile = {};

		ctrl.init = function() {
			var params = {
					programId : ppfSiteProfileInfo.programId
			};
			// init cust prop define
			ppfSiteProfileService.initCustProp(layoutConfig, $scope, ctrl);
			//
			// init general
			ppfSiteProfileService.initGeneral($scope, ctrl).then(function() {
				authService.view(params).then(function(response) {
					var initPpfSiteProfile = response.data || ppfSiteProfileInfo;
					ctrl.action = "view";
					// ctrl.ppfSiteProfile = initPpfSiteProfile; done in initLayoutConfig
					ppfSiteProfileService.initLayoutConfigAndModel($scope, ctrl, initPpfSiteProfile, ctrl.action);
				});
			});
		};
		
	}
})(angular);